﻿@using vITs.Site.Models.DataModels
@{
   
    ViewBag.Title = "Granksa Uppdrag";
}
<h2>Granskar Uppdrag</h2>

@{
    this.Html.RenderAction("ViewAssignment", "Assignment", new { AssignmentId = this.ViewBag.Assignment.AssignmentId });
}

@if (VitsExtensionMethods.GetStatus(this.ViewBag.Assignment) == AssignmentStatus.AssignmentDraft) 
{       
    using (Html.BeginForm("VerifyAssignment", "Assignment", new { AssignmentId = this.ViewBag.Assignment.AssignmentId, Status = (Int32)AssignmentStatus.AssignmentApproved } ))
    {
        <input type="submit" value="Godkänn Uppdrag" />
    }
    using (Html.BeginForm("VerifyAssignment", "Assignment", new { AssignmentId = this.ViewBag.Assignment.AssignmentId, Status = (Int32)AssignmentStatus.AssignmentRejected }))
    {
        <input type="submit" value="Avslå Uppdrag" />
    }
} 

@if (VitsExtensionMethods.GetStatus(this.ViewBag.Assignment) == AssignmentStatus.AdvanceRequested)
{
    using (Html.BeginForm("VerifyAssignment", "Assignment", new { AssignmentId = this.ViewBag.Assignment.AssignmentId, status = (Int32)AssignmentStatus.AdvanceApproved }))
    {
        <input type="submit" value="Godkänn Förskott" />
    }
    using(Html.BeginForm("VerifyAssignment", "Assignment", new { AssignmentId = this.ViewBag.Assignment.AssignmentId, status = (Int32)AssignmentStatus.AdvanceRejected }))
    {
        <input type="submit" value="Avslå Förskott" />
    }
}

@if (this.ViewBag.Assignment.Status == (Int32)AssignmentStatus.Submitted)
{
    using (Html.BeginForm("VerifyAssignment", "Assignment", new { AssignmentId = this.ViewBag.Assignment.AssignmentId, status = (Int32)AssignmentStatus.Finalized }))
    {
        <input type="submit" value="Godkänn slutfört uppdrag" />
    }
    using (Html.BeginForm("VerifyAssignment", "Assignment", new { AssignmentId = this.ViewBag.Assignment.AssignmentId, status = (Int32)AssignmentStatus.Rejected }))
    {
        <input type="submit" value="Avslå slutfört uppdrag" />
    }
}